package cn.edu.scau.cmi.liujianxun.singleton;

import java.util.HashSet;
import java.util.Set;

public class Marshal {

	private static Set<Marshal> marshalSet = new HashSet<Marshal>();
	
	private String name;
	
	private Marshal(String name) {
		this.name = name;
	}
	
	public static Set<Marshal> getInstance(String name) {
		if(marshalSet.size() < 10 && name != null) {
			Marshal m = new Marshal(name);
			marshalSet.add(m);
		}
		return marshalSet;
	}
	
	public static Set<Marshal> getMarshalSet() {
		return marshalSet;
	}
	
	public static int size() {
		return marshalSet.size();
	}
	
	public String getName() {
		return this.name;
	}
}
